﻿@model GroupDto
@section MainStyle{


    <!-- bradcam_area_start -->
    <div class="bradcam_area breadcam_bg overlay2">
        <h3>Group Details</h3>
    </div>
    <!-- bradcam_area_end -->

}
<div class="card">
    <h5 class="card-header">Group</h5>
    <div class="card-body">
        <h5 class="card-title">@Html.DisplayFor(model => model.Name)</h5>
        <div class="input-group mb-3">
            <button id="basic-addon1" class="input-group-text" data-clipboard-text="@Model.CodeJion" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Copy CodeJoin"><i class="far fa-copy"></i></button>
            <input type="text" class="form-control" readonly value="@Model.CodeJion" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1">
        </div>
        <ol class="list-group list-group-numbered mt-2 mb-2">
            @foreach (var item in Model.Groups)
            {
                var user = item.UserProfile.ApplicationUser;
                <li class="list-group-item"><img style="max-width: 50px;margin-right: 5px" class="rounded float-left" src="@user.Image" /><h4>@(user.Email.GetNameFromEmail())</h4> </li>
            }
        </ol>
        <a class="boxed_btn_orange" asp-action="Index" asp-controller="Quizes" asp-route-Groupid="@Model.Id">Quizes</a>
        @if ((int)ViewData["UserId"] == Model.AdminId)
        {

            <a class="boxed_btn_orange" asp-action="Create" asp-controller="Quizes" asp-route-groupid="@Model.Id"><i class="fas fa-plus"></i> Add Quize</a>
            <a class="btn btn-primary" asp-action="Index" asp-route-groupId="@Model.Id" asp-controller="GroupPermission">Manage permission</a>
        }
        @if (Model.GroupPermissions.FirstOrDefault(a => a.UserProfileId == (int)ViewData["UserId"] && a.Create) != null)
        {
            <a class="boxed_btn_orange" asp-action="Create" asp-controller="Quizes" asp-route-groupid="@Model.Id"><i class="fas fa-plus"></i> Add Quize</a>
        }
       

    </div>
</div>
@section Scripts{
    <script src="~/js/clipboard.min.js"></script>
    <script>
        var clipboard = new ClipboardJS('.input-group-text');

        clipboard.on('success', function (e) {
            console.info('Action:', e.action);
            console.info('Text:', e.text);
            console.info('Trigger:', e.trigger);
            e.clearSelection();
        });

        clipboard.on('error', function (e) {
            console.error('Action:', e.action);
            console.error('Trigger:', e.trigger);
        });
    </script>

}





